<script setup>
import {ref} from "vue";

let roleTableData = ref([
  {
    name: "管理员",
    status: "enable",
    sort: 0,
  },
  {
    name: "领导",
    status: "enable",
    sort: 0,
  },
  {
    name: "业务员",
    status: "enable",
    sort: 0,
  },
])
</script>

<template>
  <div style="display: flex; flex-flow: column nowrap; width: 100%; height: 100%; overflow: hidden;">
    <div style="display: flex; flex-flow: row nowrap; align-items: center; height: 40px;">
      <el-form :inline="true" style="height: 30px">
        <el-form-item label="Name">
          <el-input clearable/>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleDictList">Search</el-button>
          <el-button type="primary" @click="handleDictCreate({})">New</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div style="display: flex; width: 100%; height: 100%; overflow: auto;">
      <el-table
          highlight-current-row
          @row-click="handleDictTableRowClick"
          :data="roleTableData" border style="width: 100%;">
        <el-table-column prop="name" label="name" min-width="200"/>
        <el-table-column prop="status" label="status" width="70">
          <template #default="scope">
            <el-switch
                active-value="enable"
                inactive-value="disable"
                v-model="scope.row.status "
            />
          </template>
        </el-table-column>
        <el-table-column prop="sort" label="sort" width="60"/>
        <el-table-column label="operations" width="360">
          <template #default="scope">
            <el-button @click="handleEdit(scope.$index, scope.row)">
              编辑
            </el-button>
            <el-button @click="handleEdit(scope.$index, scope.row)">
              视图权限
            </el-button>
            <el-button @click="handleEdit(scope.$index, scope.row)">
              接口权限
            </el-button>
            <el-popconfirm
                width="170"
                hide-icon
                confirm-button-text="确定"
                cancel-button-text="取消"
                @confirm="handleDictDelete(scope.row)"
                :title="'是否确认删除角色数据 [ ' + scope.row.name + ' ] ？'">
              <template #reference>
                <el-button type="danger">
                  删除
                </el-button>
              </template>
            </el-popconfirm>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div style="flex: none; display: flex; flex-flow: row nowrap; align-items: center; height: 36px; border-top: #5cadff 1px solid;">
      <el-pagination layout="total, sizes, prev, pager, next, jumper" :total="1000"/>
    </div>
  </div>
</template>

<style scoped>

</style>